<template>
  <div style="margin-top: 1.5%">
    <div class="sidebar">
      <!-- 跳转到指定模块 -->
      <el-card class="btn-box">
        <el-button
          style="margin-left: 10px"
          @click="ding"
        >消毒供应事件
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 1,20)"
        >事件情况描述
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 2,20)"
        >患者资料
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 3,20)"
        >事件基本信息
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 4,20)"
        >当事人资料
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 5,20)"
        >事件结果
        </el-button>
        <el-button
          @click="goAssignBlock('block'+ 6,20)"
        >报告者信息
        </el-button>
      </el-card>
    </div>

    <div class="content">

      <!--      手风琴效果-->
      <el-collapse style=" margin-left: 8%;" v-model="activeNames">
        <!--消毒供应事件-->
        <div class="bname"></div>
        <!--        手风琴效果-->
        <el-collapse-item name="1">
          <template #title>
            <div class="xiaodugongyingname">消毒供应事件</div>
          </template>
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="basicform" :model="basicForm" label-width="140px">
              <el-form-item label="供应消毒事件" prop="disinfectSupplyEvents"
                            :rules="[{required: true, message: '供应消毒事件未选择'}]">
                <el-radio-group v-model="basicForm.disinfectSupplyEvents">
                  <el-radio label="01">消毒物品不合格</el-radio>
                  <el-radio label="02">包内配置卡与物品不符(漏件、多件、错件)</el-radio>
                  <el-radio label="03">器械包标识错误</el-radio>
                  <el-radio label="04">热原实验阳性</el-radio>
                  <el-radio label="05">其他</el-radio>
                </el-radio-group>
              </el-form-item>
              <!--            <div v-show="basicForm.disinfectSupplyEvents== '04'">
                            <el-form-item label="其他" style="width: 600px" prop="disinfectSupplyEvents1">
                              <el-input v-model="basicForm.disinfectSupplyEvents1"></el-input>
                            </el-form-item>
                          </div>-->
            </el-form>
          </div>
        </el-collapse-item>


        <!--事件情况描述-->
        <div class="bname" ref="block1" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">
        </div>
        <!--        手风琴效果-->
        <el-collapse-item name="2">
          <template #title>
            <div class="xiaodugongyingname">事件情况描述</div>
          </template>
          <!--        <div style="color:blue;margin-top: 1%;font-size: 14px">怀疑药品</div>-->
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm1" :model="reportForm" label-width="140px">
              <el-form-item label="事件描述或事件经过" prop="situationEdescriptionProcess"
                            :rules="[{required:true, message: '事件描述或事件经过不能为空'},
            {pattern:/[^\s]/, message: '事件描述或事件经过格式不正确'}]"
                            style="width: 600px">
                <el-input type="textarea" :rows="5" maxlength="1000" v-model="reportForm.situationEdescriptionProcess"
                          resize="none"
                          placeholder="请输入内容"></el-input>
              </el-form-item>
              <el-form-item label="事件发生时是否采取处理措施" prop="situationMeasuresEvent"
                            :rules="[{required: true, message: '事件发生时是否采取处理措施未选择'}]">
                <el-radio-group v-model="reportForm.situationMeasuresEvent">
                  <el-radio label="01">是</el-radio>
                  <el-radio label="02">否</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="reportForm.situationMeasuresEvent==='01'" label="采取的处理措施"
                            prop="situationTakenMeasures" style="margin-top: 15px">
                <el-input type="textarea" :rows="5" v-model="reportForm.situationTakenMeasures" maxlength="1000"
                          resize="none"
                          placeholder="请输入内容"></el-input>
              </el-form-item>

            </el-form>

          </div>
        </el-collapse-item>

        <!--患者资料-->
        <div class="bname" ref="block2" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">
        </div>
        <!--        手风琴效果-->
        <el-collapse-item name="3">
          <template #title>
            <div class="xiaodugongyingname">患者资料</div>
          </template>
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm2" :model="reportForm" label-width="140px">
              <el-form-item label="是否涉及患者" prop="patientInvolved"
                            :rules="[{required: true, message: '是否涉及患者未选择'}]">
                <el-radio-group v-model="reportForm.patientInvolved" style="width: 200px">
                  <el-radio label="01">是</el-radio>
                  <el-radio label="02">否</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="reportForm.patientInvolved== '01'">
                <el-form-item label="诊断类别" prop="patientDiagnosisCategory"
                              :rules="[{required: true, message: '诊断类别未选择'}]">
                  <el-radio-group v-model="reportForm.patientDiagnosisCategory">
                    <el-radio label="01">急诊</el-radio>
                    <el-radio label="02">门诊</el-radio>
                    <el-radio label="03">住院</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="病历号/门诊号" prop="patientRecordOutpatient" style="width: 600px;margin-top: 15px"
                              :rules="[{required: true, message: '病历号/门诊号不能为空'},]">
                  <!--                            {max:15, message: '病历号/门诊号不能超过15个字符'}-->
                  <el-input v-model="reportForm.patientRecordOutpatient" oninput="value=value.replace(/[^0-9.]/g,'')"
                            maxlength="20"></el-input>
                </el-form-item>
                <el-form-item label="姓名" prop="patientName" style="width: 600px;margin-top: 15px;"
                              :rules="[{required: true, message: '患者姓名不能为空'},
                            /*  { min: 1, max: 60, message: '患者姓名不能超过60个字符'},*/
                              {pattern:/^[\u4e00-\u9fa5a-zA-Z]+$/, message: '患者姓名格式不正确'}]">
                  <el-input v-model="reportForm.patientName" maxlength="50"></el-input>
                </el-form-item>
                <el-form-item label="性别" prop="patientGender"
                              :rules="[{required: true, message: '性别未选择'}]">
                  <el-radio-group v-model="reportForm.patientGender">
                    <el-radio label="01">男</el-radio>
                    <el-radio label="02">女</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="出生日期" prop="patientDateOfBirth" style="margin-top: 15px">
                  <el-date-picker
                    v-model="reportForm.patientDateOfBirth"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="年龄" prop="patientAge" style="width: 600px">
                  <!--                            :rules="[{pattern:/^-?[1-9]\d{0,2}$/, message: '年龄格式不正确'} ]"-->
                  <el-input v-model="reportForm.patientAge" oninput="value=value.replace(/[^0-9.]/g,'')"
                            maxlength="3"></el-input>
                </el-form-item>
                <!--            <el-form-item label=" ">
                              <el-radio-group v-model="form.bgPeoplepjia">
                                <el-radio label="01">岁</el-radio>
                                <el-radio label="02">月</el-radio>
                                <el-radio label="03">天</el-radio>
                                <el-radio label="04">小时</el-radio>
                              </el-radio-group>
                            </el-form-item>-->
                <el-form-item label="年龄阶段" prop="patientAgeStage" style="margin-top: 15px">
                  <el-select v-model="reportForm.patientAgeStage" placeholder="请选择" filterable>
                    <el-option
                      v-for="item in dict.type.he_patient_age_grades"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="家属联系电话" style="width: 600px;margin-top: 16px" prop="patientContact"
                              :rules="[{required: true, message: '联系方式不能为空'},
                             {pattern:/(?:[0-9-()（）]{7,18})$|^(?:0?(13|14|15|16|18|17|19)[0-9]{9})$/, message: '请输入正确的联系方式',trigger: 'blur'}]">
                  <!--             {max: 12, message: '请输入正确的联系方式'}-->
                  <el-input v-model="reportForm.patientContact" maxlength="20"></el-input>
                </el-form-item>
                <el-form-item label="入院就诊时间" prop="patientAdmissionTime" style="margin-top: 15px">
                  <el-date-picker
                    v-model="reportForm.patientAdmissionTime"
                    type="datetime"
                    placeholder="选择日期时间">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="科室" prop="patientDepartment">
                  <el-select v-model="reportForm.patientDepartment" placeholder="请选择" filterable>
                    <el-option
                      v-for="item in dict.type.he_department_name"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="床号" style="width: 600px" prop="patientBedNumber">
                  <!--                            :rules="[{ min: 1, max: 15, message: '床号不能超过15个字符'}]"-->
                  <el-input v-model="reportForm.patientBedNumber" oninput="value=value.replace(/[^0-9.]/g,'')"
                            maxlength="20"></el-input>
                </el-form-item>
                <el-form-item label="护理级别" prop="patientNursingLevel">
                  <el-radio-group v-model="reportForm.patientNursingLevel">
                    <el-radio label="01">特级护理</el-radio>
                    <el-radio label="02">Ⅰ级护理</el-radio>
                    <el-radio label="03">Ⅱ级护理</el-radio>
                    <el-radio label="04">Ⅲ级护理</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="文化程度" prop="patientEducationLevel">
                  <el-radio-group v-model="reportForm.patientEducationLevel">
                    <el-radio label="01">研究生</el-radio>
                    <el-radio label="02">大学本科</el-radio>
                    <el-radio label="03">大学专科</el-radio>
                    <el-radio label="04">中专（中技）</el-radio>
                    <el-radio label="05">高中</el-radio>
                    <el-radio label="06">初中</el-radio>
                    <el-radio label="07">小学</el-radio>
                    <el-radio label="08">文盲</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="诊断(多个诊断之间用逗号隔开)" style="width: 600px" prop="patientDiagnosis">
                  <!--                            :rules="[ {max:500,message: '诊断不能超过500个字符'}]"-->
                  <el-input type="textarea" :rows="5" v-model="reportForm.patientDiagnosis" resize="none"
                            placeholder="请输入内容" maxlength="500"></el-input>
                </el-form-item>
              </div>
            </el-form>
          </div>
        </el-collapse-item>
        <!--事件基本信息-->
        <div class="bname" ref="block3" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">
        </div>
        <!--        手风琴效果-->
        <el-collapse-item name="4">
          <template #title>
            <div class="xiaodugongyingname">事件基本信息</div>
          </template>
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm3" :model="reportForm" label-width="140px">
              <el-form-item label="发生时间" prop="occurrenceTime"
                            :rules="[{required: true, message: '发生时间不能为空'}]">
                <el-date-picker
                  v-model="reportForm.occurrenceTime"
                  type="datetime"
                  placeholder="选择日期时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="发生日期" prop="occurrenceDate" style="margin-top: 15px"
                            :rules="[{required: true, message: '发生日期不能为空'}]">
                <el-date-picker
                  v-model="reportForm.occurrenceDate"
                  type="date"
                  placeholder="选择日期时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="日期类型" prop="occurrenceDateType" style="margin-top: 15px">
                <el-radio-group v-model="reportForm.occurrenceDateType">
                  <el-radio label="01">工作日</el-radio>
                  <el-radio label="02">周末</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="发生时段" prop="occurrenceTimePeriod">
                <el-radio-group v-model="reportForm.occurrenceTimePeriod">
                  <el-radio label="01">上午(08：00-12：00)</el-radio>
                  <el-radio label="02">中午(12：00-14：00)</el-radio>
                  <el-radio label="03">下午(14：00-18：00)</el-radio>
                  <el-radio label="04">上夜(18：00-00：00)</el-radio>
                  <el-radio label="05">下夜(00：00-08：00)</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="发生地点" style="width: 600px" prop="occurrenceLocation">
                <!--                            :rules="[
                             /*   {pattern:/^[\u4e00-\u9fa5a-zA-Z0-9]+$/,message: '发生地点格式不正确', trigger: 'blur'},*/
                                {max:60,message: '发生地点不能超过60个字符'}]"-->
                <el-input v-model="reportForm.occurrenceLocation" maxlength="50"></el-input>
              </el-form-item>
              <!--上传图片-->
              <el-form-item label="现场照片" prop="occurrenceScenePhotos" style="margin-top: 15px">
                <image-upload :limit="1" v-model="reportForm.occurrenceScenePhotos"/>
              </el-form-item>
              <!--          <el-form-item label="事件发生时是否采取处理措施" :rules="[{required: true, message: '事件发生时是否采取处理措施未选择'}]">-->
              <!--            <el-radio-group v-model="form.medicineType">-->
              <!--              <el-radio label="是"></el-radio>-->
              <!--              <el-radio label="否"></el-radio>-->
              <!--            </el-radio-group>-->
              <!--          </el-form-item>-->
              <!--          <el-form-item label="采取的处理措施" >-->
              <!--            <el-input type="textarea" :rows="5" v-model="form.approvalNum" resize="none" placeholder="请输入内容"></el-input>-->
              <!--          </el-form-item>-->
            </el-form>
          </div>
        </el-collapse-item>

        <!--当事人资料-->
        <div class="bname" ref="block4" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">
        </div>
        <!--        手风琴效果-->
        <el-collapse-item name="5">
          <template #title>
            <div class="xiaodugongyingname">当事人资料</div>
          </template>
          <!--        <div style="color:blue;margin-top: 1%;font-size: 14px">怀疑药品</div>-->
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm4" :model="reportForm" label-width="140px">
              <el-form-item label="姓名" prop="partyName" style="width: 600px"
                            :rules="[{required: true, message: '当事人姓名不能为空'},
                            /*  { min: 1, max: 60, message: '当事人姓名不能超过60个字符'},*/
                              {pattern:/^[\u4e00-\u9fa5a-zA-Z]+$/, message: '当事人姓名格式不正确'}]">
                <el-input v-model="reportForm.partyName" maxlength="50"></el-input>
              </el-form-item>
              <el-form-item label="年龄" style="width: 600px;margin-top: 15px" prop="partyAge">
                <!--                            :rules="[{pattern:/^-?[1-9]\d{0,2}$/, message: '当事人年龄格式不正确'} ]"-->
                <el-input v-model="reportForm.partyAge" oninput="value=value.replace(/[^0-9.]/g,'')"
                          maxlength="3"></el-input>
              </el-form-item>
              <el-form-item label="工作年限" prop="partyYearsOfExperience">
                <el-radio-group v-model="reportForm.partyYearsOfExperience">
                  <el-radio label="01"><1年</el-radio>
                  <el-radio label="02">1≤y≤2</el-radio>
                  <el-radio label="03">2≤y≤5</el-radio>
                  <el-radio label="04">5≤y≤10</el-radio>
                  <el-radio label="05">10≤y≤20</el-radio>
                  <el-radio label="06">≥20年</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="类别" prop="partyCategory">
                <el-radio-group v-model="reportForm.partyCategory">
                  <el-radio label="01">在编</el-radio>
                  <el-radio label="02">聘用</el-radio>
                  <el-radio label="03">进修</el-radio>
                  <el-radio label="04">实习</el-radio>
                  <el-radio label="05">轮转</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="学历" prop="partyEducation">
                <el-radio-group v-model="reportForm.partyEducation">
                  <el-radio label="01">中专</el-radio>
                  <el-radio label="02">大专</el-radio>
                  <el-radio label="03">本科</el-radio>
                  <el-radio label="04">硕士</el-radio>
                  <el-radio label="05">其他</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="职务" prop="partyPosition">
                <el-radio-group v-model="reportForm.partyPosition">
                  <el-radio label="01">医疗</el-radio>
                  <el-radio label="02">药剂</el-radio>
                  <el-radio label="03">护理</el-radio>
                  <el-radio label="04">医技</el-radio>
                  <el-radio label="05">检验</el-radio>
                  <el-radio label="06">工程技术</el-radio>
                  <el-radio label="07">行政管理</el-radio>
                  <el-radio label="08">后勤保障</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-form>
          </div>
        </el-collapse-item>

        <!--事件结果-->
        <div class="bname" ref="block5" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%"></div>
        <!--        手风琴效果-->
        <el-collapse-item name="6">
          <template #title>
            <div class="xiaodugongyingname">事件结果</div>
          </template>
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm5" :model="reportForm" label-width="140px">
              <el-form-item label="纠纷或纠纷隐患可能性" prop="resultsPossibilityDispute"
                            :rules="[{required: true, message: '纠纷或纠纷隐患可能性未选择'}]">
                <el-radio-group v-model="reportForm.resultsPossibilityDispute">
                  <el-radio label="01">确定有</el-radio>
                  <el-radio label="02">可能有</el-radio>
                  <el-radio label="03">无</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="事件严重程度" prop="resultsEventSeverity" style="margin-top: 15px"
                            :rules="[{required: true, message: '事件严重程度未选择'}]">
                <el-select v-model="reportForm.resultsEventSeverity" placeholder="请选择" filterable>
                  <el-option
                    v-for="item in dict.type.he_event_severity"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="事件分级" style="width: 600px" prop="resultsEventClassification"
                            :rules="[{required: true, message: '事件分级未选择'}]">
                <el-radio-group v-model="reportForm.resultsEventClassification">
                  <el-radio label="01" style="margin-top: 10px; margin-bottom: 10px">Ⅰ级事件: 发生错误，造成患者死亡 (包括损害程度I级)
                  </el-radio>
                  <el-radio label="02" style="margin-bottom: 10px">Ⅱ级事件: 发生错误，且造成患者伤害 (包括损害程度E、F、G、H级)</el-radio>
                  <el-radio label="03" style="margin-bottom: 10px">Ⅲ级事件: 发生错误，但未造成患者伤害 (包括损害程度B、C、D级)</el-radio>
                  <el-radio label="04">Ⅳ级事件: 错误未发生 (错误隐患)(包括损害程度A级)</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="伤害严重度" prop="resultsSeverityInjury"
                            :rules="[{required: true, message: '伤害严重度未选择'}]">
                <el-radio-group v-model="reportForm.resultsSeverityInjury">
                  <el-radio label="01">死亡</el-radio>
                  <el-radio label="02">极度严重</el-radio>
                  <el-radio label="03">重度</el-radio>
                  <el-radio label="04">中度</el-radio>
                  <el-radio label="05">轻度</el-radio>
                  <el-radio label="06">未造成伤害</el-radio>
                  <el-radio label="07">无伤害</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-form>
          </div>

        </el-collapse-item>

        <!--  报告者信息-->
        <div class="bname" ref="block6" style="border-top: 1px solid rgba(165,169,175,0.29);padding-top:0.5%">
        </div>
        <!--        手风琴效果-->
        <el-collapse-item name="7">
          <template #title>
            <div class="xiaodugongyingname">报告者信息</div>
          </template>
          <div class="block" style="margin-top: 0.5%;">
            <el-form ref="reportForm6" :model="reportForm" label-width="140px">
              <el-form-item label="事件呈报方式" prop="reportMethod"
                            :rules="[{required: true, message: '事件呈报方式未选择'}]">
                <el-radio-group v-model="reportForm.reportMethod">
                  <el-radio label="01">主动呈报</el-radio>
                  <el-radio label="02">投诉</el-radio>
                  <el-radio label="03">他人报告</el-radio>
                  <el-radio label="04">质量检查发现</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="其他信息备注" style="width: 600px;margin-top: 15px">
                <!--                            :rules="[ {max:500,message: '其他信息备注不能超过500个字符'}]" prop="reportOtherRemarks">-->
                <el-input type="textarea" :rows="5" v-model="reportForm.reportOtherRemarks" resize="none"
                          placeholder="请输入内容" maxlength="500"></el-input>
              </el-form-item>
              <!--上传图片-->
              <el-form-item label="附件图片" prop="reportAttachedImages" style="margin-top: 15px">
                <image-upload :limit="1" v-model="reportForm.reportAttachedImages"/>
              </el-form-item>
            </el-form>
          </div>
        </el-collapse-item>
      </el-collapse>
    </div>

    <!--保存按钮-->
    <div style="position: fixed; margin-top: -0.5%; right: 3%; width: 300px">
      <el-button
        type="primary"
        style="margin-left: 15px"
        @click="baocun"
      >保存
      </el-button>
      <el-button
        type="info" plain
        style="margin-left: 15px"
        @click="fanhui"
      >返回
      </el-button>
    </div>

  </div>
</template>


<script>
import ScrollPane from "@/layout/components/TagsView/ScrollPane";
import {addBasic, updateBasic} from "@/api/module/xj/basic";
import {getBasic} from "@/api/module/shao/shijian/basic";

export default {
  dicts: ['he_undesirable_report_type', 'he_department_name', 'he_administration_route', 'he_undesirable_dosage_form', 'he_undesirable_unit', 'he_patient_status', 'undesirable_drug_type', 'he_piping_type', 'he_report_event_type', 'he_medication_error_type', 'he_education', 'he_patient_gender', 'he_party_post', 'he_report_event_state', 'he_report_event_type', 'he_patient_age_grades', 'he_event_severity', 'he_review_status', 'he_report_status', 'he_position', 'he_event_classification', 'he_review_event_type', 'he_possibility_of_dispute', 'he_patient_involved', 'he_patient_ethnic_group', 'he_fallback_status', 'he_occurrence_time_period', 'he_event_determinatione', 'he_situation_measures_event', 'he_patient_education_level', 'he_diagnosis_category', 'he_years_of_experience', 'he_severity_of_injury', 'he_reporting_method', 'he_patient_nursing_level', 'he_date_type', 'he_invalidation_status', 'he_patient_ethnic_group', 'he_category', 'he_handling_status'],
  components: {ScrollPane},
  data() {
    return {
      activeNames: ['1', '2', '3', '4', '5', '6', '7'],
      formEvent: {
        //代表是事件基本信息表
        heEventBasic: {},
        //代表事件上传信息表
        heEventReport: {},
        //代表事件流程表
        heEventFlow: {},

      },
      basicForm:
        {
          disinfectSupplyEvents: null,
          disinfectSupplyEvents1: null
        },
      reportForm: {
        reportEventType: '10',
        reviewEventType: '01',
        situationEdescriptionProcess: null,
        pipelineDateCatheterization: null,
        situationMeasuresEvent: null,
        situationTakenMeasures: null,
        patientInvolved: null,
        patientId: null,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        occurrenceTime: null,
        occurrenceDate: null,
        occurrenceDateType: null,
        occurrenceTimePeriod: null,
        occurrenceLocation: null,
        occurrenceScenePhotos: null,
        partyName: null,
        partyAge: null,
        partyYearsOfExperience: null,
        partyCategory: null,
        partyEducation: null,
        partyPosition: null,
        partyPost: null,
        resultsPossibilityDispute: null,
        resultsEventSeverity: null,
        resultsEventClassification: null,
        resultsSeverityInjury: null,
        reportMethod: null,
        reportAttachedImages: null,
        reportOtherRemarks: null,
        note1: '',
      },
      //代表事件流程表
      flowForm: {},
      ageStageOption: [
        {
          value: '01',
          label: '新生儿'
        }, {
          value: '02',
          label: '1-6月'
        }, {
          value: '03',
          label: '7-12月'
        }, {
          value: '04',
          label: '1-6岁'
        }, {
          value: '05',
          label: '7-12岁'
        }, {
          value: '06',
          label: '13-18岁'
        }, {
          value: '07',
          label: '19-64岁'
        }, {
          value: '08',
          label: '65岁以上'
        }, {
          value: '09',
          label: '其他'
        },
      ],
      ageStageOption1: [ //科室
        {
          value: '信息科',
        }, {
          value: '外科',
        }, {
          value: '妇产科',
        }, {
          value: '麻醉科',
        }
      ],
      ethnicGroupOption: [],

      fileList1: [],
      fileList2: [],
    }
  },
  // 禁止web端屏幕缩放
  created() {
    //与渲染一样的反显
    //把传过来的参id赋值给report对象的id
    this.formEvent.heEventReport.id = this.$route.query.id;
    //判断是否赋值成功，成功则为通过id查询事件反显，
    if (this.formEvent.heEventReport.id) {
      // this.isDisabled=true;
      getBasic(this.formEvent.heEventReport.id).then(response => {
        //获取后台传过来的表单
        this.formEvent = response.data;
        //将其对应赋值进行表单渲染
        this.basicForm = this.formEvent.heEventBasic
        this.reportForm = this.formEvent.heEventReport
        //用于多选框反显
        /*this.checkList=this.pushCheckbox(this.basicForm.bedTreatmentConditions)
        this.yuanyin=this.pushCheckbox(this.basicForm.bedReasonsFalling)
        this.chuli=this.pushCheckbox(this.basicForm.bedFallDisposal)*/

      });
    }
    /* //---------------分割线------------------
     window.addEventListener("mousewheel", function (event) {
       if (event.ctrlKey === true || event.metaKey) {
         event.preventDefault();
       }
     }, {passive: false})*/
  },
  methods: {
    fanhui() {
      //返回方法更新
      //如果参数id存在，表示从草稿事件修改跳转过来的，返回草稿事件界面
      if (this.formEvent.heEventReport.id != null) {
        this.$router.push({path: "/hosipitalevent/caogaoshijian"});
      } else {
        //如果参数id不存在，表示从上报事件界面跳转过来的，返回主页界面
        this.$router.push({path: "/hosipitalevent/report"});
      }
      /*this.$router.push({path: "/hosipitalevent/report"});*/
    },
    popCheckbox(boxlist) {
      let str = '';
      for (let i = 0; i < boxlist.length; i++) {
        if (i === 0) {
          str = boxlist[i];
        } else {
          str = str + ',' + boxlist[i];
        }
      }
      return str;
    },
    //保存按钮事件
    baocun() {
      this.$refs["basicform"].validate(valid => {
        if (valid) {
          this.$refs["reportForm1"].validate(valid => {
            if (valid) {
              this.$refs["reportForm2"].validate(valid => {
                if (valid) {
                  this.$refs["reportForm3"].validate(valid => {
                    if (valid) {
                      this.$refs["reportForm4"].validate(valid => {
                        if (valid) {
                          this.$refs["reportForm5"].validate(valid => {
                            if (valid) {
                              this.$refs["reportForm6"].validate(valid => {
                                if (valid) {
                                  if (this.reportForm.patientAdmissionTime !== null) {
                                    this.reportForm.patientAdmissionTime = this.reportForm.patientAdmissionTime.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                                    this.reportForm.patientAdmissionTime = this.reportForm.patientAdmissionTime.replace(/\//g, '-')
                                  }
                                  if (this.reportForm.patientDateOfBirth !== null) {
                                    this.reportForm.patientDateOfBirth = this.reportForm.patientDateOfBirth.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                                    this.reportForm.patientDateOfBirth = this.reportForm.patientDateOfBirth.replace(/\//g, '-')
                                  }
                                  if (this.reportForm.occurrenceTime !== null) {
                                    this.reportForm.occurrenceTime = this.reportForm.occurrenceTime.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                                    this.reportForm.occurrenceTime = this.reportForm.occurrenceTime.replace(/\//g, '-')
                                  }
                                  if (this.reportForm.occurrenceDate !== null) {
                                    this.reportForm.occurrenceDate = this.reportForm.occurrenceDate.toLocaleString('zh-CN', {timeZone: 'Asia/Shanghai',hour12: false})
                                    this.reportForm.occurrenceDate = this.reportForm.occurrenceDate.replace(/\//g, '-')
                                  }
                                  this.reportForm.note1 = "消毒供应事件"
                                  //将代表事件上报信息表的字段内容赋值给heEventReport对象用于连接后台
                                  this.formEvent.heEventReport = this.reportForm
                                  //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
                                  this.formEvent.heEventBasic = this.basicForm
                                  //将代表事件基本信息表的字段内容赋值给heEventReport对象用于连接后台
                                  this.formEvent.heEventFlow = this.flowForm
                                  //判断修改或新增
                                  //与上面一样判断id,存在为修改，不存在为新增
                                  if (this.formEvent.heEventReport.id != null) {
                                    updateBasic(this.formEvent).then(response => {
                                      this.$modal.msgSuccess("修改成功");
                                      //这里要注意跳转的界面为草稿事件界面
                                      this.$router.push({path: "/hosipitalevent/caogaoshijian"});
                                    });
                                  } else {
                                    addBasic(this.formEvent).then(response => {
                                      this.$modal.msgSuccess("新增成功");
                                      //进行页面跳转
                                      this.$router.push({path: "/index"});
                                    });
                                  }
                                  //---------------分割线------------------
                                }
                              })
                            }
                          })
                        }
                      });
                    }
                  })
                }
              })
            }
          });
        }
      })
    },
    ding() {
      window.scrollTo(0, 0);
    },
    //el 标签  speed 滚动速率 此处是50px 值越大滚动的越快
    goAssignBlock(el, speed) {
      let t = this.$refs[el].offsetTop - 100

      function scrollToTop() {
        let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;

        if (scrollTop > t) {
          window.scrollTo(0, scrollTop - speed);

          // 使用 requestAnimationFrame 进行平滑滚动
          requestId = window.requestAnimationFrame(scrollToTop);
        } else {
          window.scrollTo(0, t);

          // 取消动画帧的请求
          window.cancelAnimationFrame(requestId);
        }
      }

      let requestId = window.requestAnimationFrame(scrollToTop);
    },
    //上传图片
    handleRemove(file) {
      this.fileList = this.fileList.filter(item => item.uid !== file.uid);
    },
    handleExceed() {
      this.msgError("最多只能传500张照片");
    },
    beforeUpload(file) {
      const isJPG = file.type === "image/jpeg" || file.type == "image/png";
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isJPG) {
        this.$message.error("上传头像图片只能是 JPG 或 PNG 格式!");
        return;
      }
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
        return;
      }
      const fileData = new FormData();
      fileData.append("avatar", file);
      //upload为上传的接口
      upload(fileData).then(res => {
        this.imgUrl = res.imgUrl;
        //对返回的图片地址进行回显
        this.$set(this.form, "avatar", this.imgUrl);
      });
      //阻止传到本地浏览器
      return false;
    },


  }
}

</script>

<style lang="scss" scoped>
@import "src/views/module/shao/blackFont";

.sidebar {
  margin-left: 3%;
  width: 10%;
  float: left;
  display: flex;
}

.content {
  margin-left: 3%;
  margin-right: 1.5%;
  width: 87%;
  float: right;
}

.btn-box {
  position: fixed;
  margin-top: 1%;

  ::v-deep .el-card__body {
    padding: 15px 15px 15px 5px;
  }
}

.btn-box button {
  text-align: left;
  padding: 0 0 0 10px;
  display: block;
  width: 150px;
  height: 40px;
  border: none;
  cursor: pointer;
}

.btn-box button:hover {
  background: hsl(221, 98%, 68%);
  color: white;
}

.block {
  border: 1px solid white;
  width: 100%;
  height: 100%;
  display: flex;
  font-size: 5rem;
  box-sizing: border-box;

  .el-form-item {
    margin-bottom: 10px;
  }
}

.bname {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: #606266;
}

.xiaodugongyingname {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
  font-weight: bold;
  font-size: 20px;
  color: black;
}

</style>
